import { useMemberStore } from '@/stores'

const useSettingHooks = () => {
  const memberStore = useMemberStore()
  // 退出登录
  const onLogout = () => {
    // 模态弹窗
    uni.showModal({
      content: '是否退出登录？',
      confirmColor: '#27BA9B',
      success: (res) => {
        if (res.confirm) {
          // 清理用户信息
          memberStore.clearProfile()
          // 返回上一页
          uni.navigateBack()
        }
      },
    })
  }

  return {
    memberStore,
    onLogout,
  }
}

export default useSettingHooks
